package cndw.core.dispatch;

import java.io.Serializable;

/**
 * @author zuojie.x
 */
class DefaultResponse implements Response, Serializable {
	private static final long serialVersionUID = 1L;
	private int code;
	private int actionId;
	private Object result;
	
	public DefaultResponse(ResponseCode code, Request request, Object result) {
		this.code = code.code;
		this.actionId = request != null ? request.getActionId() : -1;
		this.result = result;
	}
	
	@Override
	public int getCode() {
		return code;
	}
	
	@Override
	public int getActionId() {
		return actionId;
	}

	@Override
	public Object getResultDTO() {
		return result;
	}

	@Override
	public String toString() {
		return "DefaultResponse [code=" + code + ", actionId=" + actionId
				+ ", result=" + result + "]";
	}
}
